package cn.reinforce.util.echarts;

import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Data;

import java.util.ArrayList;
import java.util.List;

@Data
@JsonInclude(JsonInclude.Include.NON_NULL)
public class Line {
    private String title;

    private List<String> legend = new ArrayList<>();

    private List<String> xAxis = new ArrayList<>();

    private List<Series> series = new ArrayList<>();


    @Data
    @JsonInclude(JsonInclude.Include.NON_NULL)
    public class Series {

        private String name;

        private String type;

        private String stack;

        private int precision;

        private List<Double> data = new ArrayList<>();

        private Label label;

        private ItemStyle itemStyle;

        private AreaStyle areaStyle;

        private LineStyle lineStyle;

        private MarkLine markLine;

        private boolean showAllSymbol;

    }

    @Data
    @JsonInclude(JsonInclude.Include.NON_NULL)
    public class AreaStyle {
        private Style normal;

        private Style emphasis;

    }

    @Data
    @JsonInclude(JsonInclude.Include.NON_NULL)
    public class LineStyle {
        private Style normal;
    }

    @Data
    @JsonInclude(JsonInclude.Include.NON_NULL)
    public class MarkLine {
        private List<MarkLineData> data = new ArrayList<>();

    }

    @Data
    @JsonInclude(JsonInclude.Include.NON_NULL)
    public class MarkLineData {
        private String type;

        private String xAxis;

        private String yAxis;

        private String name;


        public MarkLineData(String type, String xAxis, String yAxis, String name) {
            this.type = type;
            this.xAxis = xAxis;
            this.yAxis = yAxis;
            this.name = name;
        }
    }
}
